#include"commit.hpp"
#include"log.hpp"
using namespace std;


int main()
{
    //客户端进行写入
    Log log;
    //打开管道
    int fd=open(FIFO_FILE,O_WRONLY);
    if(fd<0)
    {
        perror("open");
        exit(FIFO_OPEN_ERR);
    }
    log(Info,"open fifo success,fd:%d",fd);

    //进行通信，写入
    string buf;
    while(true)
    {
        cout<<"client say@";
        //cin>>buf;//cin会以空格或者/n为分隔符
        getline(cin,buf);//只以/n为分隔符
        write(fd,buf.c_str(),buf.size());
    }
    log(Info,"write fifo success");

    //关闭管道
    close(fd);



    return 0;
}